#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int n,m,t,sx,sy,ex,ey,x,y,book[10][10],ans;
int st[5][5]={{0,1},{0,-1},{1,0},{-1,0}};
void dfs(int x1,int y1)
{    
	if(x1==ex&&y1==ey){ans++;return;}

	for(int i=0;i<4;i++)
	{
		int x2=x1+st[i][0],y2=y1+st[i][1];
		if(x2<=n && x2>=1 && y2<=n && y2>=1 && !book[x2][y2])
		{
			book[x2][y2]=1;
			dfs(x2,y2);
			book[x2][y2]=0;
		}
	}
}
int main()
{
    freopen("maze.in","r",stdin);
	 freopen("maze.out","w",stdout);
	 cin>>n>>m>>t>>sx>>sy>>ex>>ey;
	 for(int i=1;i<=t;i++)
	 {
		 cin>>x>>y;
		 book[x][y]=1;
	 }
	 book[sx][sy]=1;
	 dfs(sx,sy);
	 cout<<ans;
	 fclose(stdin);
	 fclose(stdout);
}
